package buildinjava.ant;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Singleton;

/**
 * Holds the Guice injector.
 *
 * @author Gili Tzabari
 */
@Singleton
public final class InjectorProvider
{
	private static final Injector injector = Guice.createInjector();

	/**
	 * Prevent construction.
	 */
	private InjectorProvider()
	{
	}

	/**
	 * Returns the injector.
	 *
	 * @return the injector
	 * @throws IllegalStateException if injector is null
	 */
	public static Injector getInjector() throws IllegalStateException
	{
		return injector;
	}
}
